/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by Administrator on 2017/3/9.
	 */
	var Tabs = __webpack_require__(27);
	var TabItem = Tabs.TabItem;

	function callback(key) {
	    console.log(key);
	}

	var Root=React.createClass({displayName: "Root",
	    render:function(){
	        return (
	            React.createElement("div", null, 
	                React.createElement(Tabs, {defaultActiveKey: 0, onclick: callback}, 
	                    React.createElement(TabItem, {tab: "Tab 1"}, "Content of Tab Pane 1"), 
	                    React.createElement(TabItem, {tab: "Tab 2"}, "Content of Tab Pane 2"), 
	                    React.createElement(TabItem, {tab: "Tab 3", disabled: true}, "Content of Tab Pane 3"), 
	                    React.createElement(TabItem, {tab: "Tab 4"}, "Content of Tab Pane 4")
	                )
	            )
	        );
	    }
	});

	ReactDOM.render(React.createElement(Root, null), document.getElementById("main"));

/***/ },

/***/ 27:
/***/ function(module, exports) {

	var TabItem=React.createClass({displayName: "TabItem",
	    render:function(){
	        return (this.props.children);
	    }
	});
	/**
	 * @class Tabs
	 * My neat class.
	 * @author John Doe <john@example.com>
	 */
	var Tabs=React.createClass({displayName: "Tabs",
	    getDefaultProps:function(){
	        return {
	            disabled:false,
	            defaultActiveKey:1
	        }
	    },
	    getInitialState:function(){
	        return {
	            currentIndex : this.props.defaultActiveKey
	        };
	    },
	    checkTitleIndex:function(index){
	        if(this.state.currentIndex==-1){
	            return "";
	        }else{
	            return index===this.state.currentIndex ? "ucs-tabs-active" : "";
	        }
	    },
	    checkContentIndex:function(index){
	        if(this.state.currentIndex==-1){
	            return "none";
	        }else{
	            return index===this.state.currentIndex ? "block" : "none";
	        }
	    },
	    _handleClick:function(index,disabled,e){
	        var source = e.target || e.srcElement;
	        if(!disabled){
	            var disabled=disabled?'disabled':'';
	            for(var i = 0; i < source.parentNode.childNodes.length; i++){
	                source.parentNode.childNodes[i].className = "";
	                this.refs['ucs-tabs-content'].childNodes[i].style.display = "none";
	            }
	            this.state.currentIndex = index;
	            source.className = disabled+" "+this.checkTitleIndex(index);
	            this.refs['ucs-tabs-content'].childNodes[index].style.display = "block";
	        }
	    },
	    render:function(){
	        var _this=this;
	        return(
	            React.createElement("div", {className: "ucs-tabs"}, 
	                React.createElement("div", {className: "ucs-tabs-bar"}, 
	                    React.createElement("ul", null, 
	                        
	                            _this.props.children.map(function(element,index){
	                                var disabled=element.props.disabled?'disabled':'';
	                                return(
	                                    React.createElement("li", {onclick: _this._handleClick.bind(_this,index,element.props.disabled), className: disabled+" "+_this.checkTitleIndex(index)}, 
	                                         element.props.tab
	                                    )
	                                );
	                            })
	                        
	                    )
	                ), 
	                React.createElement("div", {className: "ucs-tabs-content", ref: "ucs-tabs-content"}, 
	                    
	                        _this.props.children.map(function(element,index){
	                            return(
	                                React.createElement("div", {className: "ucs-tabs-tabpane", style:  "display:"+ _this.checkContentIndex(index)}, 
	                                    element.props.children
	                                )
	                            );
	                        })
	                    
	                )
	            )
	        );
	    }
	});

	Tabs.TabItem=TabItem;
	module.exports = Tabs;

/***/ }

/******/ });